/*
 * Copyright (C) 2023 xuexiangjys(xuexiangjys@163.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.xuexiang.templateproject.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.xuexiang.templateproject.R;
//import com.jcds.common.R$id;
//import com.jcds.common.R$layout;
//import com.jcds.common.R$style;
//import d.e.a.b;
//import d.e.a.l.k.h;

/* loaded from: classes.dex */
public class LoadingDialog extends Dialog {

    /* loaded from: classes.dex */
    public static class Builder {
        private Context context;
        private String message;
        private boolean isShowMessage = true;
        private boolean isCancelable = false;
        private boolean isCancelOutside = false;

        public Builder(Context context) {
            this.context = context;
        }

        public LoadingDialog create() {
            View inflate = LayoutInflater.from(this.context).inflate(R.layout.dialog_loading, (ViewGroup) null);
            LoadingDialog loadingDialog = new LoadingDialog(this.context, R.style.MyDialogStyle);
            TextView textView = (TextView) inflate.findViewById(R.id.tipTextView);
            Glide.with(this.context).load("file:///android_asset/app-loading.gif").diskCacheStrategy(DiskCacheStrategy.DATA).into((ImageView) inflate.findViewById(R.id.ivLoading));
            if (this.isShowMessage) {
                textView.setText(this.message);
            } else {
                textView.setVisibility(View.GONE);
            }
            loadingDialog.setContentView(inflate);
            loadingDialog.setCancelable(this.isCancelable);
            loadingDialog.setCanceledOnTouchOutside(this.isCancelOutside);
            return loadingDialog;
        }

        public Builder setCancelOutside(boolean z) {
            this.isCancelOutside = z;
            return this;
        }

        public Builder setCancelable(boolean z) {
            this.isCancelable = z;
            return this;
        }

        public Builder setMessage(String str) {
            this.message = str;
            return this;
        }

        public Builder setShowMessage(boolean z) {
            this.isShowMessage = z;
            return this;
        }
    }

    public LoadingDialog(Context context) {
        super(context);
    }

    public LoadingDialog(Context context, int i2) {
        super(context, i2);
    }
}